package de.upb.messerschmidt.set.oauth;

import oauth.signpost.OAuthConsumer;
import oauth.signpost.OAuthProvider;
import oauth.signpost.basic.DefaultOAuthConsumer;

/**
 * This helper Class provides all the important information our application
 * needs to communicate with Mendeley.
 * 
 * @author Tim Messerschmidt
 * 
 */
public class OAuthData {
	// Application Data
	public static final String CONSUMERKEY = "LONGKEY";
	public static final String CONSUMERSECRET = "LONGSECRET";
	// Mendeley OAuth urls
	public static final String BASEURL = "http://www.mendeley.com/oauth/";
	public static final String REQUESTTOKEN = BASEURL + "request_token/";
	public static final String ACCESSTOKEN = BASEURL + "access_token/";
	public static final String AUTHORIZE = BASEURL + "authorize/";

	/**
	 * Our basic OAuth components
	 */
	private static OAuthConsumer consumer = null;
	private static OAuthProvider provider = null;

	public static OAuthConsumer getConsumer() {
		if (consumer == null) {
			consumer = new DefaultOAuthConsumer(CONSUMERKEY, CONSUMERSECRET);
		}
		return consumer;
	}

	public static OAuthProvider getProvider() {
		if (provider == null) {
			provider = new MendeleyOAuthProvider(REQUESTTOKEN, ACCESSTOKEN,
					AUTHORIZE);
		}
		return provider;
	}
}
